package com.ymttest.database.sqlwapper.shenqisettlement;

import java.util.HashMap;
import java.util.List;

import com.ymt.core.tool.Logger;
import com.ymt.database.SqlManager;
import com.ymttest.database.model.shenqisettlement.MchFeeConfig;
import com.ymttest.utils.YMTDateUtil;

public class MchFeeConfigWrapper {

	SqlManager manager;

    public MchFeeConfigWrapper() {
        manager = new SqlManager("shenqisettlement");
    }
    
    @SuppressWarnings("unchecked")
	public MchFeeConfig selectByPrimaryKey(Long id) {
    	    	
    	List<MchFeeConfig> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.MchFeeConfigMapper.selectByPrimaryKey",
                        id);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("mch_fee_config没有数据");
			
			return null;
		}
		
		return result.get(0);
    }
    
    @SuppressWarnings("unchecked")
	public MchFeeConfig selectByHashMap(HashMap<String, Object> map) {
    	
    	List<MchFeeConfig> result = manager
                .getSelectResults(
                        "com.ymttest.database.mapping.shenqisettlement.MchFeeConfigMapper.selectByHashMap",
                        map);
        manager.commit();
        
		if (result.size() == 0) {
			Logger.comment("mch_fee_config没有数据");
			
			return null;
		}
		
		return result.get(0);
    }
    
	public Integer deleteAutotestData() {
    	
    	HashMap<String, String> map = new HashMap<>();

    	map.put("begin_time", YMTDateUtil.getBeforeOrNextDay(-1, YMTDateUtil.YMD));
    	map.put("end_time", YMTDateUtil.getBeforeOrNextDay(0, YMTDateUtil.YMD));
    	
    	int result = manager
                .delete(
                        "com.ymttest.database.mapping.shenqisettlement.MchFeeConfigMapper.deleteAutotestData",
                        map);
        manager.commit();
		
		return result;
    }
	
    public static void main(String[] args) {
    	
    	MchFeeConfigWrapper test = new MchFeeConfigWrapper();
    	
    	System.out.println(test.deleteAutotestData());
    }
}
